﻿using System.Threading;
using Hopscotch.Domain.Common;
using Hopscotch.Server.Common.Contracts;

namespace Hopscotch.Server.EnqServiceFake
{
    public abstract class FakeEnqServiceBase<T, TKey> : IInternalEnquiryService<T, TKey>
        where T : IEnquiryEntity<TKey>
        where TKey : struct
    {
        protected virtual string EntityType
        {
            get
            {
                return typeof(T).Name;
            }
        }

        protected void FakeDelay(int delay = 1000)
        {
            //Simulate some latency
            Thread.Sleep(delay);
        }

        public string Ping()
        {
            return string.Format("Hello\n{0}", this.GetType().Name);
        }

        public abstract T Get(TKey id);
    }
}
